<div class="container">

    <div class="row">
        <div class="span2">
            <?php
            $menu = 'menu_' . $this->usertype . '.php';
            include($menu);
            ?>
        </div>

        <div class="span10">
            <h3 class="topic">ตรวจผู้ป่วย</h3>
            <div class="well" style="min-height:750px;">

                <ul class="nav nav-tabs">
                    <li >
                        <a href="<?php echo base_url() . 'doctor/check_pat/' . $pat['pat_id'] . '/'; ?>">ตรวจร่างกาย</a><br/>
                    </li>
                    <li >
                        <a href="<?php echo base_url() . 'doctor/check_pat/' . $pat['pat_id'] . '/ตรวจก่อนทำสวยงาม'; ?>">ตรวจก่อนทำสวยงาม</a>
                    </li>
                    <li class="active">
                        <a href="#">ตรวจหลังทำสวยงาม</a>
                    </li>
                    <li>
                        <a href="<?php echo base_url() . 'doctor/check_pat/' . $pat['pat_id'] . '/ประเมิณ'; ?>">ประเมิณ</a>
                    </li>

                </ul>
                <?php
                if (isset($check) && $check !== false) {
                    foreach ($check as $key => $value2) {
                        
                    }
                } else {
                    $value2 = false;
                }
                ?>

                <form method="post" action="<?php echo base_url(); ?>doctor/query_check_pat_after/<?php echo $pat['pat_id'] ?>/<?php echo $value2['check_id'] ?>/<?php echo $type ?>">
                    <div>
                        <div  style="width:50%;float:left"> 
                            <?php include('check_pat_info.php'); ?>

                        </div>

                        <div  style="width:50%;float:left;">     
                            <label for="title" class="label_set">การตรวจหลังทำสวยงามแล้ว</label>
                            <div class="control-group">
                                <label for="title" class="control-label">วันที่ตรวจหลังทำสวยงาม</label>
                                <?php
                                if ($value2['date_check_after'] == '' or $value2['date_check_after'] == '0000-00-00 00:00:00' or $value2['date_check_after'] != date('Y-m-d H:i:s')) {
                                    ?>
                                    <input type="hidden"  name="date_check_after" value="<?php echo date('Y-m-d') ?>" ><?php echo date('Y-m-d'); ?>
                                    <?php
                                } else {
                                    ?>
                                    <input type="date"  name="date_check_after" value="<?php echo $value2['date_check_after'] ?>" >

                                <?php } ?>
                            </div>


                            <div class="control-group">
                                <div class="controls">
                                    <input type="radio"  id="result_1" name="result" value="ดี" onchange="result_set(1)" <?php echo ($value2['result']) == 'ดี' ? 'checked' : '' ?>> ดี <br>
                                    <input type="radio"  id="result_2" name="result" value="แก้ไข" onchange="result_set(2)" <?php echo ($value2['result']) == 'แก้ไข' ? 'checked' : '' ?>> แก้ไข  <br>
                                    <textarea name="result_detail" class="result_detail"><?php echo $value2['result_detail'] ?></textarea>
                                </div>
                                <script>

                                    var val = $('.result_detail').val();
                                    if (val != '')
                                    {
                                        $('.result_detail').show();
                                    }
                                    else
                                    {
                                        $('.result_detail').hide();
                                    }

                                    function result_set(id)
                                    {

                                        var id = "result_" + id;
                                        var val = $('#' + id).val();
                                        if (val == 'แก้ไข')
                                        {
                                            $('.result_detail').show();
                                        }
                                        else
                                        {
                                            $('.align_detail').hide();
                                        }
                                    }

                                </script>
                            </div>
                            <div class="control-group">
                                <label for="title" class="control-label">ความคิดเห็นอื่น</label>
                                <div class="controls">
                                    <textarea name="result_detail"><?php echo $value2['result_detail'] ?></textarea>
                                </div>
                            </div>


                            <div class="control-group">
                                <div class="controls">
                                    <input type="hidden" name="doc_id_after" value="<?php echo $this->user_id; ?>">
                                    <input type="hidden" name="check_type" value="การประเมิณ">
                                </div>
                            </div>

                            <div class="control-group">
                                <div class="controls">
                                    <a href="<?php echo $_SERVER['HTTP_REFERER']; ?>" name="submit" class="btn btn-large btn-danger" style="float:right;margin-left: 5px;">ย้อนกลับ</a>
                                    <input type="submit"  name="submit" value="บันทึก" class="btn btn-large btn-primary" style="float:right">
                                </div>
                            </div>

                        </div> 

                    </div>     





                </form>

            </div>

        </div>
    </div>  


</div>
<hr>
<script language="javascript" type="text/javascript">


    function add_order()
    {
        $('#del').removeAttr('disabled');
        // $("#tool").append($("<strong>Hello</strong>").html());
        $("#tool").append($('#add_more').html());

        // validate engin ==============================
        $("#post").validationEngine();
        $(window).dblclick(function() {
            jQuery('#post').validationEngine('hide');
        });
        // validate engin ==============================
    }




</script>

<div id="add_more" style="display: none;">

    <div id='add_form_order' class="add_order" >
        <select name="order_type[]" id="order_type" onchange="check_type();" class="order_type validate[required] m_set">
            <option value="สั่งทำ" ></i>สั่งทำ</option>
            <option value="ซ่อมแซม" ></i>ซ่อมแซม</option>
            <option value="ไม่ทำ" ></i>ไม่ทำ</option>
        </select>
        <select name="tool_id[]" id="tool_id" onchange="" class="tool_id validate[required] m_set">
            <option value="" ></i>อุปกรณ์</option>
            <option value="1" ></i>ขาเทียม</option>
            <option value="2" ></i>ขาเทียม2</option>
            <option value="3" ></i>ขาเทียม3</option>
            <option value="4" ></i>อื่นๆ ระบุ</option>

        </select>
        <input type="text" placeholder="เหตุผล" name="order_cause[]" id="order_cause" class="order_cause" >
    </div>                                 
</div>  

